import {Route} from "react-router-dom"
import routeMap from "./routrMap"

function createRoute(routeArr){
    return routeArr.map((item)=>{
        if(item.children && item.children.length > 0){
            return <Route path={item.path} Component={routeMap[item.Component]} key={item.path}>
                        {createRoute(item.children)}
                    </Route>
        }else{
            return <Route path={item.path} Component={routeMap[item.Component]} key={item.path}></Route>
        }
        
    })

}


export default createRoute